unit lsComponent;

interface

uses
  Forms, ExtCtrls, XMLIntf;

type
  TlsComponent = class
  private
    procedure ResponseTimer(Sender: TObject);
  protected
    FParent: TForm;
    FTimer: TTimer;
    FAction: String;
    procedure innerDoAction(AAction: String); virtual;
  public
    constructor Create(AParent: TForm;AlsConfig: IXMLNode);virtual;
    destructor  Destroy; override;
    procedure Recv(AMsg:String);virtual;
    procedure DoAction(AAction: String;ADelay: Integer);virtual;
    procedure Refresh;virtual;
    function  DefaultOfVar(ANode: IXMLNode): String;
    procedure AssignVar(AVar: IXMLNode);virtual;
    procedure SetProperty(ANode: IXMLNode);virtual; //<left>100</left>
  end;

implementation

uses
  SysUtils;

{ TlsComponent }

procedure TlsComponent.AssignVar(AVar: IXMLNode);
begin

end;

constructor TlsComponent.Create(AParent: TForm; AlsConfig: IXMLNode);
begin
  FTimer := TTimer.Create(nil);
end;

function TlsComponent.DefaultOfVar(ANode: IXMLNode): String;
begin

end;

destructor TlsComponent.Destroy;
begin
  FreeAndNil(FTimer);

  inherited;
end;

procedure TlsComponent.DoAction(AAction: String; ADelay: Integer);
begin
  FTimer.Interval := ADelay;
  FTimer.OnTimer := ResponseTimer;
  FTimer.Enabled := True;
end;

procedure TlsComponent.innerDoAction(AAction: String);
begin

end;

procedure TlsComponent.Recv(AMsg: String);
begin

end;

procedure TlsComponent.Refresh;
begin

end;

procedure TlsComponent.ResponseTimer(Sender: TObject);
begin
  innerDoAction(FAction);
  FTimer.OnTimer := nil;
  FTimer.Enabled := False;
end;

procedure TlsComponent.SetProperty(ANode: IXMLNode);
begin

end;

end.
